package com.sikaryofficial.backend.config;

import com.sikaryofficial.system.api.model.qrcode.ProductQrUrlVO;
import lombok.Getter;
import lombok.Setter;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.cloud.context.config.annotation.RefreshScope;
import org.springframework.context.annotation.Configuration;

import java.util.List;

/**
 * @author : qinjinyuan
 * @desc : ProductQrUrlConfig
 * @date : 2023/10/31 16:51
 */
@Configuration
@RefreshScope
@ConfigurationProperties(prefix = "hismk.backend")
@Getter
@Setter
public class ProductQrUrlConfig {
    private List<ProductQrUrlVO> qrScanUrlList;


    public ProductQrUrlVO getQrUrlByTenantId(Integer tenantId) {
        return qrScanUrlList.stream().filter(item -> item.getTenantId().equals(tenantId)).findFirst().orElse(new ProductQrUrlVO());
    }
}
